ke.create({
	data:{
		loadList:true,
		list:[],
		total:0,
		size:20,

		search:{
			key:'',
			date:''
		},

		dateQuick: {
          disabledDate:function(time) {
            return time.getTime() > Date.now();
          },
          shortcuts: [{
            text: '最近一周',
            onClick:function(picker) {
              var end = new Date();
              var start = new Date();
              start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
              picker.$emit('pick', [start, end]);
            }
          }, {
            text: '最近一个月',
            onClick:function(picker) {
              var end = new Date();
              var start = new Date();
              start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
              picker.$emit('pick', [start, end]);
            }
          }, {
            text: '最近三个月',
            onClick:function(picker) {
              var end = new Date();
              var start = new Date();
              start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
              picker.$emit('pick', [start, end]);
            }
          }, {
            text: '半年内',
            onClick:function(picker) {
              var end = new Date();
              var start = new Date();
              start.setTime(start.getTime() - 3600 * 1000 * 24 * 180);
              picker.$emit('pick', [start, end]);
            }
          }
          ]
        },
	},
	methods:{
		tabSize:function(s){
			this.size = s
			this.loadLists(1)
		},
		loadLists:function(p){
			this.loadList = true
			http.get({
				params:{
					size:this.size,
					page:p,
					key:this.search.key,
					date:this.search.date
				},
				success:function(res){
					vm.loadList = false
					if(res.code ===0 ){
						vm.$message.error(res.msg)
					}else{
						vm.list = res.data.list
						vm.total = res.data.total
						vm.scrollTop()
					}
				}
			})
		},
		onDelete:function(id){
			this.$confirm('此操作将彻底删除该记录，是否继续？',{
				callback:function(type){
					if(type=='confirm'){
						http.post({
							url:vm.map.delete,
							data:{id:id},
							success:function(res){
								if(res.code===0){
									vm.$message.error(res.msg)
								}else{
									vm.$message.success('删除成功')
									setTimeout(function(){
										vm.reload()
									},800)
								}
							}
						})
					}
				}
			})
		},
		onSearch:function(){
			this.loadLists(1)
		}
	},
	created:function(){
		this.loadLists(1)
		this.$notify.info({
			title:'提示',
        	message: '日志只会保存最新的3000条'
        })
        if(this.data.date){
        	this.search.date=this.data.date
        }
	}
})